/////////////////////////////////////////////////////////////////////////
//
// Amuse Engine SDK - core/memory
// Copyright( c) 2014.  All Rights Reserved
//
// File:		AEProperty.h
// Author:		Gianluca Belardelli
// Date:		07/05/2014
//
/////////////////////////////////////////////////////////////////////////
#ifndef _AEPROPERTY_H_
#define _AEPROPERTY_H_

#define MAX_PROPNAME_LEN	31

class AEProperty
{
private:
	enum AEPropertyFlags
	{
		AEPF_READ			= 1,
		AEPF_WRITE			= 2,
		AEPF_TEMP			= 4,
		AEPF_READONLY		= 8,
		AEPF_DEFAULT		= AEPF_READ | AEPF_WRITE
	};

	char		m_szName[ MAX_PROPNAME_LEN + 1 ];
	AEUINT32	m_uiFlags;
	void		*m_lpData;

	union
	{
		char		*lpValue;
		int			nValue;
		float		fValue;
	}m_uPropValues;

public:
	AE_FORCEINLINE AEProperty( void );
	AE_FORCEINLINE ~AEProperty( void );

	template <typename T> AE_FORCEINLINE T &GetValue( void );
	template <typename T> AE_FORCEINLINE void SetValue( const T &tValue );

	template <typename T> AE_FORCEINLINE void Bind( const char *lpName, T *tVar );

	AE_FORCEINLINE const char *GetName( void );
	AE_FORCEINLINE void SetName( const char *lpPropName );
};

#include "AEProperty.inl"

/*
template <typename _T>
class AEProperty : public AEPropertyBase
{
// Members
protected:
	_T*	m_lpData;

public: 
	typedef _T AEAttributeType;

// Methods
private:
	AEProperty &operator=( const AEProperty & );
	AEProperty( const _T& tVal );

	/// \brief Destroys the object managed by this attribute. 
	/// \remark Does not destroy the attribute itself.
	AE_FORCEINLINE void Destroy( void );

public:
	/// \brief Default Constructor for Attribute
	/// \remark By default, attributes are initalized with the default behavior.
	AEProperty( void ) : m_lpData(0) { }
	AE_FORCEINLINE AEProperty( char *lpName, _T* tVar );
	AE_FORCEINLINE AEProperty( const AEProperty &tVar );

	virtual ~AEProperty( void )	{ }

	AEProperty<_T> AE_FORCEINLINE &operator=( const _T &tVal );

	/// \brief Bind associates a string name, with the address of a variable in memory.
	/// \param name The string name to associate with this variable.  Must be unique.
	/// \param val The address of the variable associated with this attribute
	/// \param nBehavior The behavior of this attribute
	AE_FORCEINLINE void Initialize( char *lpName, _T* tVal );

	/// \brief Retrieves the value of the variable associated with this attribute
	/// \param[out] data This paramater is used to store the value of the attribute variable.
	/// \return true if data was initialized with the attribute value or false if not.
	AE_FORCEINLINE void GetValue( _T &tData );

	/// \brief Sets the value of the attribute
	/// \param data contains the new value to initialize the attribute variable to.
	/// \remark The type of this new value must be the same type as the orginially bound
	/// value, otherwise this function will fail and return false.
	/// \return true on success, or false if it fails. Failure typically means that
	/// the type of the data argument is inconsistent with the type of the stored variable.
	AE_FORCEINLINE void SetValue( const _T &tData );
};

#include "AEProperty.inl"
*/

/*
#define MAX_PROPNAME_LEN	31
#define MAX_VALUES_COUNT	4

class AEProperty
{
// Members
public: 
	enum AEPropertyTypes
	{
        AEPT_NONE			= 0,
        AEPT_BOOL			= 1,
        AEPT_ENUM			= 2,
        AEPT_INT32			= 3,
        AEPT_FLOAT32		= 4,
        AEPT_STRING			= 5,
        AEPT_VECTOR2		= 6,
		AEPT_VECTOR3		= 7,
        AEPT_VECTOR4		= 8,
        AEPT_QUATERNION		= 9,
        AEPT_COLOR3			= 10,
        AEPT_COLOR4			= 11,
		AEPT_MAX
	};

	enum AEPropertyFlags
	{
		AEPF_INVALID		= 0,
		AEPF_VALID			= 1,
		AEPF_READONLY		= 2
	};
protected:
	char			m_szName[ MAX_PROPNAME_LEN + 1 ];
	char			*m_lpDescr;

	AEPropertyTypes	m_ptType;
	AEPropertyFlags	m_pfFlags;

	union AEPropertyValue
	{
		AEBOOL32	bBoolVal;
		AEINT32		nInt32Val;
		AEFLOAT32	fFloat32Val;
		void		*lpPtr;
	};

	AETArray<char *>			m_arrEnumOptions;
	AETArray<AEPropertyValue>	m_arrValues;
	AETArray<char *>			m_arrValuesNames;

// Methods
private:
	/// \brief Destroys the object managed by this attribute. 
	/// \remark Does not destroy the attribute itself.
	AE_FORCEINLINE void Destroy( void );

public:
	/// \brief Costruttore di default.
	/// \remark Per default il costruttore inizializza solo il membro m_pfFlags con 
	/// il valore AEPF_INVALID
	AE_FORCEINLINE AEProperty( void );
	AE_FORCEINLINE ~AEProperty( void );

	/// \brief Bind associates a string name, with the address of a variable in memory.
	/// \param name The string name to associate with this variable.  Must be unique.
	/// \param val The address of the variable associated with this attribute
	/// \param nBehavior The behavior of this attribute
	AE_FORCEINLINE void Initialize( const char *lpName, AEPropertyTypes ptType, AEPropertyFlags pfFlags = AEPF_VALID, const char *lpDescr = 0L );

	/// \brief Retrieves the value of the variable associated with this attribute
	/// \param[out] data This paramater is used to store the value of the attribute variable.
	/// \return true if data was initialized with the attribute value or false if not.
	AE_FORCEINLINE const char *GetName( void );
	AE_FORCEINLINE AEPropertyTypes GetType( void );
	AE_FORCEINLINE AEPropertyFlags GetFlags( void );
	AE_FORCEINLINE void SetFlags( AEPropertyFlags pfFlags );
	AE_FORCEINLINE void ClearFlags( void );

	AE_FORCEINLINE AEBOOL32 GetBoolValue( void );
	AE_FORCEINLINE AEINT32 GetInt32Value( void );
	AE_FORCEINLINE AEFLOAT32 GetFloat32Value( void );
	AE_FORCEINLINE char *GetStringValue( void );
	AE_FORCEINLINE void *GetPtrValue( void );

	AE_FORCEINLINE void SetValue( const AEBOOL32 &bValue, AEINT32 nIndex = 0 );
	AE_FORCEINLINE void SetValue( const AEINT32 &nValue, AEINT32 nIndex = 0  );
	AE_FORCEINLINE void SetValue( const AEFLOAT32 &fValue, AEINT32 nIndex = 0 );
	AE_FORCEINLINE void SetValue( const char *lpValue, AEINT32 nIndex = 0 );
	AE_FORCEINLINE void SetValue( const void *lpPtr, AEINT32 nIndex = 0 );


};

#include "AEProperty.inl"
*/
#endif // _AEPROPERTY_H_
